﻿@model Tasks.UI.Models.PrintHead.EditPrintHeadModel
@{
    ViewBag.Title = "EditPrintHead";
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>抬头编辑</title>
    <link href="@Config.GetCssResourcePath("main.css")" rel="stylesheet" type="text/css" />
    <link href="@Config.GetCssResourcePath("table.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Scripts/jquery-impromptu.3.1.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-impromptu.3.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.combobox.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/global.js")" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            IsCheckBoxDisplay();
        });
        function saveFun(src) {
            $("#act").val(src);
            document.forms[0].submit();
        }
        function IsSelect() {
            var obj = $("#ckbDefalut");
            if (obj.attr("checked") == true) {
                $("#IsDefalut").val(1);
            } else {
                $("#IsDefalut").val(0);
            }
        }
        function IsCheckBoxDisplay() {
            if ($("#IsDefaultCount").val() == 1) {
                $("#ckbDefalut").attr("disabled", true);
            }
            if ($("#IsDefalut").val() == 1) {
                $("#ckbDefalut").attr("disabled", false);
                $("#ckbDefalut").attr("checked", true);
            }
        }
        function ConfirmDel(objId) {

            $.Msg.confirmDelete(
             function () {
                 $("#form1").unbind();
                 $("#objID").val(objId);
                 saveFun("delete");
             }
        );
        }
        function newPrintHead() {
            window.location = "EditPrintHead";
        }
    </script>
</head>
<body>
    @using (Html.BeginForm("EditPrintHead", "SystemSetting", new { id = "form1" }, FormMethod.Post, new { enctype = "multipart/form-data" }))
    {
        @Html.HiddenFor(t => t.PID)
        @Html.HiddenFor(t => t.act)
        @Html.HiddenFor(t => t.objID)
        @Html.HiddenFor(t => t.IsDefaultCount)
        <div id="container">
            <div class="navTitle">
                编辑抬头信息
            </div>
            @Html.OutputMessage(Model.Message, Model.MessageType)
            <div id="horizontal">
                <div id="tabs">
                    <div id="tabs-1" class="editForm">
                        <table style="width: 100%;" border="0">
                            <tr>
                                <td style="width: 110px;">
                                    <strong>抬头名称：</strong>
                                </td>
                                <td>
                                    @Html.TextBoxFor(t => t.Name, new{style="width:350px;" })
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <strong>抬头图片：</strong>
                                </td>
                                <td>
                                    <table>
                                        <tr>
                                            <td rowspan="3">
                                                @if (!string.IsNullOrEmpty(Model.ImgPaths))
                                                {
                                                    <img src="/uploads/@Model.ImgPaths" alt="" border="0" width="100px" height="100px"/>
                                                }
                                                else
                                                {
                                                    <img src="/images/album_upload_dtbg.jpg" alt="" border="0" width="100px" height="100px" />
                                                }
                                                <input id="ImgPaths" type="hidden" name="ImgPaths" value="@Model.ImgPaths"/>
                                            </td>
                                            <td>
                                                <input id="File1" name="files" type="file" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                (JPG、PNG格式，JPG品质可在9-10之间，尺寸建议为650*80,每张张图不能超过2M)
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <button class="big blue" type="button" onclick="saveFun('upload')">
                                                    <span>上传图片</span></button>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <strong>设为默认抬头：</strong>
                                </td>
                                <td>
                                    @Html.HiddenFor(t => t.IsDefalut)
                                    <input id="ckbDefalut" type="checkbox" name="ckbDefalut" onchange="IsSelect()" />
                                </td>
                            </tr>
                        </table>
                        <button class="big blue" type="button" onclick="saveFun('save')">
                            <span>保存</span></button>
                        <button class="big blue" type="button" onclick="newPrintHead()">
                            <span>新增</span></button>
                    </div>
                </div>
                @if (Model.PrintHeadList != null)
                {
                    <table border="0" cellspacing="0" cellpadding="0" class="tblStyle1">
                        <thead>
                            <tr align="center">
                                <th style="width: 80px">
                                    是否默认
                                </th>
                                <th>
                                    抬头名称
                                </th>
                                <th style="width: 320px">
                                    抬头图片
                                </th>
                                <th style="width: 120px">
                                    操作
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach (PrintHead head in Model.PrintHeadList)
                            {
                                <tr align="center">
                                    <td>
                                        @if (head.IsDefalut == 1)
                                        {
                                            <span>是</span>
                                      
                                        }
                                        else
                                        {
                                            <span>否</span>
                                        }
                                    </td>
                                    <td>
                                        @head.Name
                                    </td>
                                    <td>
                                        @if (!string.IsNullOrEmpty(head.ImgPath))
                                        {
                                            <img src="/uploads/@head.ImgPath" alt="" border="0" width="320px" height="40px"/>
                                        }
                                        else
                                        {
                                            <span>暂未上传图片</span>
                                        }
                                    </td>
                                    <td width="200">
                                        <a href="EditPrintHead?PID=@head.ID&PageIndex=@Model.PageIndex">编辑</a> <a href="javascript:void(0)" onclick="ConfirmDel(@head.ID)">
                                            删除</a>
                                    </td>
                                </tr>
                            }
                        </tbody>
                    </table>
                    <span>抬头默认为图片.没图片则显示名称</span>
                }
                <br />
                @Html.RenderPageNav(Model.PageIndex, Model.PageSize, Model.RowCount, "", PageNavStyle.Form)
            </div>
        </div>
    }
</body>
</html>
